package cn.dengta.webapp.trade.entity;

import java.util.Date;

import cn.dengta.webapp.base.entity.TimeBasedEntity;
import cn.dengta.webapp.trade.model.GroupVipLevel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * 用户购买群VIP记录
 *
 * @author zxy
 * @since 2022-07-05
 */
@Setter
@Getter
@Accessors(chain = true)
@TableName("tr_user_group_vip_log")
public class UserGroupVipLog extends TimeBasedEntity {

	private static final long serialVersionUID = 1L;

	/** 用户ID */
	Long userId;
	/** 支付ID tr_recharge_log */
	Long rechargeId;
	/** 等级：1=VIP; 2=SVIP; 3=SSVIP; 4=SUPER VIP; 5=TOP VIP */
	GroupVipLevel groupVipLevel;

	/**
	 * 创建对象并初始化数据
	 */
	public static UserGroupVipLog of(Long userId, Long rechargeId, GroupVipLevel level) {
		UserGroupVipLog log = new UserGroupVipLog();
		log.setUserId(userId);
		log.setRechargeId(rechargeId);
		log.setGroupVipLevel(level);
		final Date now = new Date();
		log.initTime(now);
		return log;
	}

	public static final String USER_ID = "user_id";
	public static final String RECHARGE_ID = "recharge_id";
	public static final String GROUP_LEVEL = "group_vip_level";

}
